#cloud-config
password: {{ rootpass }}
chpasswd: { expire: False }
ssh_pwauth: True
hostname: {{ item }}
local-hostname: {{ item }}
fqdn: {{ item }}.example.com
manage_etc_hosts: True
preserve_hostname: False

# Remove cloud-init when finished with it
runcmd:
  - [ yum, -y, remove, cloud-init ]
  - echo "GATEWAY={{ hostvars[item]['gateway'] }}" >> /etc/sysconfig/network
  - echo "nameserver 8.8.8.8" >> /etc/resolv.conf
  - echo "domain example.com" >> /etc/resolv.conf
  - /etc/init.d/network restart
  - ifdown eth0
  - ifup eth0
# Configure where output will go
output:
  all: ">> /var/log/cloud-init.log"

# configure interaction with ssh server
ssh_svcname: ssh
ssh_deletekeys: True
ssh_genkeytypes: ['rsa', 'ecdsa']

# Install my public ssh key to the first user-defined user configured
# in cloud.cfg in the template (which is centos for CentOS cloud images)
ssh_authorized_keys:
  - {{ ssh_public_key }}